package com.zhanghuan.scheduler.job.dao;

import com.zhanghuan.scheduler.job.entity.ScheduleJobLogEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 任务日志
 *
 */
public interface ScheduleJobLogDao extends JpaRepository<ScheduleJobLogEntity,Long> {
    //分页按照beanName查找
    @Query(value="select * from schedule_job_log where bean_name like concat('%',?1,'%')  order by create_time desc limit ?2,?3",nativeQuery=true)
    List<ScheduleJobLogEntity> findAllByBeanNameLikeOrderByCreateTimeDesc(String beanName, int offset, int limit);
    //返回beanName查找的记录数
    long countAllByBeanNameLike(String beanName);
}
